<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>香橙派-RKNN-Yolov5 | 炫动空间</title>
  <meta name="keywords" content=" 部署 ">
  <meta name="description" content="香橙派-RKNN-Yolov5 | 炫动空间">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="页面未找到！生活不总是那么完美，那一个缺憾已经出现！！！">
<meta property="og:type" content="website">
<meta property="og:title" content="404">
<meta property="og:url" content="https://whghcyx.gitee.io/404.html">
<meta property="og:site_name" content="炫动空间">
<meta property="og:description" content="页面未找到！生活不总是那么完美，那一个缺憾已经出现！！！">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2019-12-28T15:30:05.000Z">
<meta property="article:modified_time" content="2023-06-19T05:58:36.657Z">
<meta property="article:author" content="宏沉一笑">
<meta property="article:tag" content="opencv">
<meta property="article:tag" content="AI">
<meta name="twitter:card" content="summary">


<link rel="icon" href="/img/avatar.jpg">

<link href="/css/style.css?v=1.0.1" rel="stylesheet">

<link href="/css/hl_theme/atom-light.css?v=1.0.1" rel="stylesheet">

<link href="//cdn.bootcss.com/animate.css/3.5.2/animate.min.css" rel="stylesheet">
<link href="//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

<script src="//cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src="/js/jquery.autocomplete.min.js?v=1.0.1" ></script>

<script src="//cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js"></script>
<script>
    hljs.initHighlightingOnLoad();
</script>

<script src="//cdn.bootcss.com/nprogress/0.2.0/nprogress.min.js"></script>



<script src="//cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.min.js" ></script>

<script src="/js/iconfont.js?v=1.0.1" ></script>

<meta name="generator" content="Hexo 4.2.1"></head>
<div style="display: none">
  <input class="theme_disqus_on" value="false">
  <input class="theme_preload_comment" value="false">
  <input class="theme_blog_path" value="">
</div>

<body>
<aside class="nav">
    <div class="nav-left">
        <a href="/" class="avatar_target">
    <img class="avatar" src="/img/avatar.jpg" />
</a>
<div class="author">
    <span>宏沉一笑</span>
</div>

<div class="icon">
    
        
        <a title="github" href="https://github.com/WHG555" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true" style="font-size:24px;">
                    <use xlink:href="#icon-github"></use>
                </svg>
            
        </a>
        
    
        
        <a title="weibo" href="http://weibo.com/u/277776871" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true" style="font-size:24px;">
                    <use xlink:href="#icon-weibo"></use>
                </svg>
            
        </a>
        
    
        
        <a title="jianshu" href="https://www.jianshu.com/u/ec364c334414" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true" style="font-size:24px;">
                    <use xlink:href="#icon-jianshu"></use>
                </svg>
            
        </a>
        
    
        
        <a title="zhihu" href="https://www.zhihu.com/people/hong-chen-yi-xiao-26/activities" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true" style="font-size:24px;">
                    <use xlink:href="#icon-zhihu"></use>
                </svg>
            
        </a>
        
    
        
    
        
        <a title="email" href="mailto:whghcyx@outlook.com" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true" style="font-size:24px;">
                    <use xlink:href="#icon-email"></use>
                </svg>
            
        </a>
        
    
        
        <a title="qq" href="http://wpa.qq.com/msgrd?v=3&uin=1002285542&site=qq&menu=yes" target="_blank">
            
                <svg class="iconfont-svg" aria-hidden="true" style="font-size:24px;">
                    <use xlink:href="#icon-qq"></use>
                </svg>
            
        </a>
        
    
</div>




<ul>
    <li><div class="all active">全部文章<small>(84)</small></div></li>
    
        
            
            <li><div data-rel="demo"><i class="fold iconfont icon-right"></i>demo<small>(5)</small></div>
                
                    <ul class="sub hide">
                        
                        <li><div data-rel="demo">demo<small>(5)</small></div>
                            
                        </li>
                            
                    </ul>
                
            </li>
            
        
    
        
            
            <li><div data-rel="知识">知识<small>(5)</small></div>
                
            </li>
            
        
    
        
            
        
    
        
            
            <li><div data-rel="安装">安装<small>(13)</small></div>
                
            </li>
            
        
    
        
            
            <li><div data-rel="AI"><i class="fold iconfont icon-right"></i>AI<small>(16)</small></div>
                
                    <ul class="sub hide">
                        
                        <li><div data-rel="数据集">数据集<small>(3)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="框架">框架<small>(5)</small></div>
                            
                        </li>
                            
                    </ul>
                
            </li>
            
        
    
        
            
        
    
        
            
        
    
        
            
            <li><div data-rel="IT"><i class="fold iconfont icon-right"></i>IT<small>(15)</small></div>
                
                    <ul class="sub hide">
                        
                        <li><div data-rel="python">python<small>(5)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="C加加">C加加<small>(1)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="LeetCode">LeetCode<small>(1)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="ROS">ROS<small>(1)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="QT">QT<small>(2)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="编译">编译<small>(4)</small></div>
                            
                        </li>
                            
                    </ul>
                
            </li>
            
        
    
        
            
            <li><div data-rel="obsidian"><i class="fold iconfont icon-right"></i>obsidian<small>(3)</small></div>
                
                    <ul class="sub hide">
                        
                        <li><div data-rel="使用"><i class="fold iconfont icon-right"></i>使用<small>(1)</small></div>
                            
                                <ul class="sub hide">
                                    
                                    <li><div data-rel="内容">内容<small>(1)</small></div>
                                    </li>
                                    
                                </ul>
                            
                        </li>
                            
                    </ul>
                
            </li>
            
        
    
        
            
        
    
        
            
            <li><div data-rel="使用"><i class="fold iconfont icon-right"></i>使用<small>(21)</small></div>
                
                    <ul class="sub hide">
                        
                        <li><div data-rel="window">window<small>(2)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="源">源<small>(2)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="VSCode">VSCode<small>(1)</small></div>
                            
                        </li>
                            
                    </ul>
                
            </li>
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
            <li><div data-rel="学习"><i class="fold iconfont icon-right"></i>学习<small>(1)</small></div>
                
                    <ul class="sub hide">
                        
                        <li><div data-rel="C加加">C加加<small>(1)</small></div>
                            
                        </li>
                            
                    </ul>
                
            </li>
            
        
    
        
            
            <li><div data-rel="软件"><i class="fold iconfont icon-right"></i>软件<small>(1)</small></div>
                
                    <ul class="sub hide">
                        
                        <li><div data-rel="安装">安装<small>(1)</small></div>
                            
                        </li>
                            
                    </ul>
                
            </li>
            
        
    
        
            
            <li><div data-rel="问题"><i class="fold iconfont icon-right"></i>问题<small>(7)</small></div>
                
                    <ul class="sub hide">
                        
                        <li><div data-rel="VS">VS<small>(1)</small></div>
                            
                        </li>
                            
                        <li><div data-rel="QT">QT<small>(1)</small></div>
                            
                        </li>
                            
                    </ul>
                
            </li>
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
        
    
        
            
            <li><div data-rel="python">python<small>(1)</small></div>
                
            </li>
            
        
    
</ul>
<div class="left-bottom">
    <div class="menus">
    
    
    
    
    </div>
    <div><a class="about  hasFriend  site_url"  href="/about">关于</a><a style="width: 50%"  class="friends">友链</a></div>
</div>
<input type="hidden" id="yelog_site_posts_number" value="84">
<input type="hidden" id="yelog_site_word_count" value="37.5k">
<div style="display: none">
    <span id="busuanzi_value_site_uv"></span>
    <span id="busuanzi_value_site_pv"></span>
</div>

    </div>
    <div class="nav-right">
        <div class="friends-area">
    <div class="friends-title">
        友情链接
        <i class="back-title-list"></i>
    </div>
    <div class="friends-content">
        <ul>
            
            <li><a target="_blank" href="https://whg555.github.io">炫动空间</a></li>
            
            <li><a target="_blank" href="https://whghcyx.gitee.io/web-url/">一笑导航</a></li>
            
        </ul>
    </div>
</div>
        <div class="title-list">
    <form onkeydown="if(event.keyCode==13){return false;}">
        <input class="search" type="text" placeholder="以 in: 开头进行全文搜索" autocomplete="off"id="local-search-input" >
        <i class="cross"></i>
        <span>
            <label for="tagswitch">Tags:</label>
            <input id="tagswitch" type="checkbox" style="display: none" />
            <i id="tagsWitchIcon"></i>
        </span>
    </form>
    <div class="tags-list">
    
    <li class="article-tag-list-item">
        <a class="color5">demo</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">下载</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">总览</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">调试</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">注释</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color2">ubuntu</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">ros</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">obsidian</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">软件</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">安卓</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">配置</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">cmd</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">Colab</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color2">tensorboard</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">conda</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">Opencv 编译</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">激活</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color2">python</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">QT</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">问题</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">Android</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">安装</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">AI</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">框架</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">模型</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">本地</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">编程语言</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">C语言</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color4">C加加</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color2">Python</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color5">ncnn</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color2">OpenCV</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color1">Linux</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">编译</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">部署</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">代码</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">日志</a>
    </li>
    
    <li class="article-tag-list-item">
        <a class="color3">界面</a>
    </li>
    
    <div class="clearfix"></div>
</div>

    
    <div id="local-search-result">

    </div>
    
    <nav id="title-list-nav">
        
        <a  class="AI "
           href="/2020/01/06/AI-2020-1-6-%E6%A8%A1%E5%9E%8B%E4%B8%8B%E8%BD%BD/"
           data-tag="下载"
           data-author="" >
            <span class="post-title" title="模型下载">模型下载</span>
            <span class="post-date" title="2020-01-06 11:57:44">2020/01/06</span>
        </a>
        
        <a id="top" class="AI "
           href="/2020/01/07/AI-2020-1-7-AI%E8%A1%8C%E4%B8%9A%E5%AD%A6%E4%B9%A0/"
           data-tag="总览"
           data-author="" >
            <span class="post-title" title="AI行业学习">AI行业学习</span>
            <span class="post-date" title="2020-01-07 10:21:30">2020/01/07</span>
        </a>
        
        <a  class="AI "
           href="/2020/01/19/AI-2020-1-19-%E6%9F%A5%E7%9C%8B%E6%A8%A1%E5%9E%8B%E4%B8%AD%E9%97%B4%E5%B1%82%E8%BE%93%E5%87%BA/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="查看模型中间层输出">查看模型中间层输出</span>
            <span class="post-date" title="2020-01-19 00:00:00">2020/01/19</span>
        </a>
        
        <a  class="AI "
           href="/2020/02/15/AI-2020-2-15-%E6%AC%A0%E6%8B%9F%E5%8C%96%E4%B8%8E%E8%BF%87%E6%8B%9F%E5%8C%96/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="欠拟合与过拟合">欠拟合与过拟合</span>
            <span class="post-date" title="2020-02-15 17:54:33">2020/02/15</span>
        </a>
        
        <a  class="AI "
           href="/2020/01/07/AI-2020-1-7-%E6%95%B0%E6%8D%AE%E9%9B%86%E4%B8%8B%E8%BD%BD/"
           data-tag="下载"
           data-author="" >
            <span class="post-title" title="数据集下载">数据集下载</span>
            <span class="post-date" title="2020-01-07 11:39:15">2020/01/07</span>
        </a>
        
        <a  class="AI 数据集 "
           href="/2020/02/04/AI-2020-2-4-COCO%E6%95%B0%E6%8D%AE%E9%9B%86/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="COCO数据集">COCO数据集</span>
            <span class="post-date" title="2020-02-04 14:48:14">2020/02/04</span>
        </a>
        
        <a  class="AI 数据集 "
           href="/2020/02/04/AI-2020-2-4-CSV%E6%95%B0%E6%8D%AE%E9%9B%86/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="CSV数据集">CSV数据集</span>
            <span class="post-date" title="2020-02-04 14:28:49">2020/02/04</span>
        </a>
        
        <a  class="AI 数据集 "
           href="/2020/02/05/AI-2020-2-5-VOC%E6%95%B0%E6%8D%AE%E9%9B%86/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="VOC数据集">VOC数据集</span>
            <span class="post-date" title="2020-02-05 14:42:38">2020/02/05</span>
        </a>
        
        <a  class="IT python "
           href="/2020/01/18/IT-2020-1-18-Python%E8%BE%93%E5%87%BA%E8%B0%83%E8%AF%95%E4%BF%A1%E6%81%AF/"
           data-tag="调试"
           data-author="" >
            <span class="post-title" title="Python输出调试信息">Python输出调试信息</span>
            <span class="post-date" title="2020-01-18 00:00:00">2020/01/18</span>
        </a>
        
        <a  class="IT python "
           href="/2020/01/18/IT-2020-1-18-%E7%9B%B8%E5%AF%B9%E5%AF%BC%E5%85%A5/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="相对导入">相对导入</span>
            <span class="post-date" title="2020-01-18 00:00:00">2020/01/18</span>
        </a>
        
        <a  class="IT python "
           href="/2020/04/02/IT-2020-4-2-ElementTree/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="xml.etree.ElementTree">xml.etree.ElementTree</span>
            <span class="post-date" title="2020-04-02 18:04:04">2020/04/02</span>
        </a>
        
        <a  class="IT C加加 "
           href="/2020/04/20/IT-2020-4-20-C-%E4%BB%A3%E7%A0%81%E6%B3%A8%E9%87%8A/"
           data-tag="注释"
           data-author="" >
            <span class="post-title" title="C++代码注释">C++代码注释</span>
            <span class="post-date" title="2020-04-20 00:00:00">2020/04/20</span>
        </a>
        
        <a  class="IT python "
           href="/2020/04/20/IT-2020-4-20-Python%E4%BB%A3%E7%A0%81%E6%B3%A8%E9%87%8A/"
           data-tag="注释"
           data-author="" >
            <span class="post-title" title="Python代码注释">Python代码注释</span>
            <span class="post-date" title="2020-04-20 00:00:00">2020/04/20</span>
        </a>
        
        <a  class="IT LeetCode "
           href="/2020/08/17/IT-2020-8-17-1%E3%80%81%E4%B8%A4%E6%95%B0%E4%B9%8B%E5%92%8C/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="1、两数之和">1、两数之和</span>
            <span class="post-date" title="2020-08-17 00:00:00">2020/08/17</span>
        </a>
        
        <a  class="安装 IT ROS "
           href="/2022/08/29/IT-2022-8-29-ubuntu%E5%AE%89%E8%A3%85%E6%B5%81%E7%A8%8B/"
           data-tag="ubuntu,ros"
           data-author="" >
            <span class="post-title" title="ros2-foxy安装流程">ros2-foxy安装流程</span>
            <span class="post-date" title="2022-08-29 00:00:00">2022/08/29</span>
        </a>
        
        <a  class="使用 window "
           href="/2020/01/06/%E4%BD%BF%E7%94%A8-2020-01-06-cmd%E8%84%9A%E6%9C%AC/"
           data-tag=""
           data-author="" >
            <span class="post-title" title="cmd脚本">cmd脚本</span>
            <span class="post-date" title="2020-01-06 10:26:03">2020/01/06</span>
        </a>
        
        <a  class="使用 "
           href="/2020/01/06/%E4%BD%BF%E7%94%A8-2020-01-06-host%E9%85%8D%E7%BD%AE/"
           data-tag=""
           data-author="" >
            <span class="post-title" title="host配置">host配置</span>
            <span class="post-date" title="2020-01-06 10:54:04">2020/01/06</span>
        </a>
        
        <a  class="使用 "
           href="/2020/01/06/%E4%BD%BF%E7%94%A8-2020-01-06-%E5%8F%B3%E9%94%AE%E8%8F%9C%E5%8D%95%E6%B7%BB%E5%8A%A0%E5%9C%A8%E6%AD%A4%E5%A4%84%E6%89%93%E5%BC%80%E5%91%BD%E4%BB%A4%E7%AA%97%E5%8F%A3/"
           data-tag="配置"
           data-author="" >
            <span class="post-title" title="右键菜单添加在此处打开命令窗口">右键菜单添加在此处打开命令窗口</span>
            <span class="post-date" title="2020-01-06 10:28:17">2020/01/06</span>
        </a>
        
        <a  class="使用 "
           href="/2019/12/30/%E4%BD%BF%E7%94%A8-2020-1-11-Git%E4%BD%BF%E7%94%A8/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="Git使用">Git使用</span>
            <span class="post-date" title="2019-12-30 16:49:44">2019/12/30</span>
        </a>
        
        <a  class="使用 window "
           href="/2020/01/10/%E4%BD%BF%E7%94%A8-2020-1-10-cmd%E5%91%BD%E4%BB%A4%E5%AD%A6%E4%B9%A0/"
           data-tag="cmd"
           data-author="" >
            <span class="post-title" title="cmd命令学习">cmd命令学习</span>
            <span class="post-date" title="2020-01-10 00:00:00">2020/01/10</span>
        </a>
        
        <a  class="使用 "
           href="/2020/01/08/%E4%BD%BF%E7%94%A8-2020-1-8-%E5%9B%BE%E5%BA%8A/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="图床">图床</span>
            <span class="post-date" title="2020-01-08 00:00:00">2020/01/08</span>
        </a>
        
        <a  class="使用 "
           href="/2019/12/30/%E4%BD%BF%E7%94%A8-2020-1-19-samba%E9%85%8D%E7%BD%AE/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="samba配置">samba配置</span>
            <span class="post-date" title="2019-12-30 16:49:44">2019/12/30</span>
        </a>
        
        <a  class="使用 "
           href="/2020/02/15/%E4%BD%BF%E7%94%A8-2020-2-21-Colab%E4%B8%AD%E4%BD%BF%E7%94%A8Git/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="colab使用git">colab使用git</span>
            <span class="post-date" title="2020-02-15 16:26:52">2020/02/15</span>
        </a>
        
        <a  class="使用 "
           href="/2020/02/21/%E4%BD%BF%E7%94%A8-2020-2-21-Colab%E4%B8%AD%E4%BD%BF%E7%94%A8tensorboard/"
           data-tag="Colab,tensorboard"
           data-author="" >
            <span class="post-title" title="Colab中使用tensorboard">Colab中使用tensorboard</span>
            <span class="post-date" title="2020-02-21 11:50:45">2020/02/21</span>
        </a>
        
        <a  class="使用 源 "
           href="/2020/02/04/%E4%BD%BF%E7%94%A8-2020-2-4-conda%E6%BA%90%E9%85%8D%E7%BD%AE/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="conda源配置">conda源配置</span>
            <span class="post-date" title="2020-02-04 12:28:26">2020/02/04</span>
        </a>
        
        <a  class="使用 源 "
           href="/2020/02/04/%E4%BD%BF%E7%94%A8-2020-2-4-pip%E6%BA%90%E9%85%8D%E7%BD%AE/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="pip源配置">pip源配置</span>
            <span class="post-date" title="2020-02-04 11:58:55">2020/02/04</span>
        </a>
        
        <a  class="使用 "
           href="/2020/03/20/%E4%BD%BF%E7%94%A8-2020-2-6-conda%E4%BD%BF%E7%94%A8/"
           data-tag=""
           data-author="" >
            <span class="post-title" title="conda使用">conda使用</span>
            <span class="post-date" title="2020-03-20 11:44:07">2020/03/20</span>
        </a>
        
        <a  class="使用 "
           href="/2020/03/24/%E4%BD%BF%E7%94%A8-2020-3-24-ffmpeg%E9%85%8D%E7%BD%AE/"
           data-tag=""
           data-author="" >
            <span class="post-title" title="ffmpeg使用">ffmpeg使用</span>
            <span class="post-date" title="2020-03-24 00:00:00">2020/03/24</span>
        </a>
        
        <a  class="使用 "
           href="/2019/12/30/%E4%BD%BF%E7%94%A8-2020-3-12-PyCharm%E4%BD%BF%E7%94%A8/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="PyCharm使用">PyCharm使用</span>
            <span class="post-date" title="2019-12-30 16:49:44">2019/12/30</span>
        </a>
        
        <a  class="使用 "
           href="/2020/04/01/%E4%BD%BF%E7%94%A8-2020-4-1-%E4%BB%A5%E7%AE%A1%E7%90%86%E5%91%98%E8%BA%AB%E4%BB%BD%E5%90%AF%E5%8A%A8%E7%A8%8B%E5%BA%8F/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="以管理员身份启动程序">以管理员身份启动程序</span>
            <span class="post-date" title="2020-04-01 09:27:51">2020/04/01</span>
        </a>
        
        <a  class="使用 "
           href="/2020/07/31/%E4%BD%BF%E7%94%A8-2020-7-31-VSCode%E4%BD%BF%E7%94%A8/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="VSCode使用">VSCode使用</span>
            <span class="post-date" title="2020-07-31 00:00:00">2020/07/31</span>
        </a>
        
        <a  class="demo demo 使用 "
           href="/2020/08/14/%E4%BD%BF%E7%94%A8-2020-8-14-VSCode%E5%A8%B1%E4%B9%90/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="VSCode娱乐">VSCode娱乐</span>
            <span class="post-date" title="2020-08-14 00:00:00">2020/08/14</span>
        </a>
        
        <a  class="使用 VSCode "
           href="/2020/08/17/%E4%BD%BF%E7%94%A8-2020-8-17-VSCode-python%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="VSCode_python环境配置">VSCode_python环境配置</span>
            <span class="post-date" title="2020-08-17 00:00:00">2020/08/17</span>
        </a>
        
        <a  class="安装 "
           href="/2020/01/06/%E5%AE%89%E8%A3%85-2020-01-06-Github%E4%B8%8EGitee%E5%85%B1%E5%AD%98/"
           data-tag="软件,配置"
           data-author="" >
            <span class="post-title" title="Github与Gitee共存">Github与Gitee共存</span>
            <span class="post-date" title="2020-01-06 09:42:24">2020/01/06</span>
        </a>
        
        <a  class="安装 "
           href="/2020/03/23/%E5%AE%89%E8%A3%85-2020-3-23-ffmpeg%E8%A7%86%E9%A2%91%E8%A7%A3%E6%9E%90%E5%BA%93/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="ffmpeg视频解析库">ffmpeg视频解析库</span>
            <span class="post-date" title="2020-03-23 17:41:31">2020/03/23</span>
        </a>
        
        <a  class="安装 "
           href="/2020/03/27/%E5%AE%89%E8%A3%85-2020-3-27-Hoekey/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="HoeKey">HoeKey</span>
            <span class="post-date" title="2020-03-27 00:00:00">2020/03/27</span>
        </a>
        
        <a  class="安装 "
           href="/2019/12/30/%E5%AE%89%E8%A3%85-2020-3-3-%E5%A4%9A%E5%B1%8F%E6%98%BE%E7%A4%BA%E7%A5%9E%E5%99%A8/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="多屏显示神器——UltraMon">多屏显示神器——UltraMon</span>
            <span class="post-date" title="2019-12-30 16:49:44">2019/12/30</span>
        </a>
        
        <a  class="安装 "
           href="/2020/03/03/%E5%AE%89%E8%A3%85-2020-3-3-%E7%BD%91%E9%80%9F%E6%98%BE%E7%A4%BA%E6%8F%92%E4%BB%B6/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="网速显示插件">网速显示插件</span>
            <span class="post-date" title="2020-03-03 14:00:56">2020/03/03</span>
        </a>
        
        <a  class="安装 "
           href="/2019/12/30/%E5%AE%89%E8%A3%85-2020-4-11-Xmind%E5%AE%89%E8%A3%85%E6%BF%80%E6%B4%BB/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="Xmind安装激活">Xmind安装激活</span>
            <span class="post-date" title="2019-12-30 16:49:44">2019/12/30</span>
        </a>
        
        <a  class="安装 "
           href="/2020/04/01/%E5%AE%89%E8%A3%85-2020-4-1-Beyond-Compare/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="Beyond_Compare">Beyond_Compare</span>
            <span class="post-date" title="2020-04-01 14:33:13">2020/04/01</span>
        </a>
        
        <a  class="安装 "
           href="/2020/04/07/%E5%AE%89%E8%A3%85-2020-4-7-PyCharm%E5%AE%89%E8%A3%85%E6%BF%80%E6%B4%BB/"
           data-tag="激活"
           data-author="" >
            <span class="post-title" title="PyCharm安装激活">PyCharm安装激活</span>
            <span class="post-date" title="2020-04-07 00:00:00">2020/04/07</span>
        </a>
        
        <a  class="软件 安装 "
           href="/2020/05/27/%E5%AE%89%E8%A3%85-2020-5-27-%E5%A4%9A%E6%A1%8C%E9%9D%A2%E5%88%87%E6%8D%A2%E8%BD%AF%E4%BB%B6/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="多桌面切换软件">多桌面切换软件</span>
            <span class="post-date" title="2020-05-27 12:01:56">2020/05/27</span>
        </a>
        
        <a  class="安装 "
           href="/2019/12/30/%E5%AE%89%E8%A3%85-2020-7-9-VSCode%E5%AE%89%E8%A3%85/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="demo">demo</span>
            <span class="post-date" title="2019-12-30 16:49:44">2019/12/30</span>
        </a>
        
        <a  class="安装 "
           href="/2020/08/23/%E5%AE%89%E8%A3%85-2020-8-23-%E5%8F%8B%E6%83%85%E5%BC%BA%E6%A1%A3/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="友情强档">友情强档</span>
            <span class="post-date" title="2020-08-23 23:15:30">2020/08/23</span>
        </a>
        
        <a  class="demo demo 安装 "
           href="/2020/08/11/%E5%AE%89%E8%A3%85-2020-8-11-VMware%E8%99%9A%E6%8B%9F%E6%9C%BA/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="VMware虚拟机">VMware虚拟机</span>
            <span class="post-date" title="2020-08-11 00:00:00">2020/08/11</span>
        </a>
        
        <a  class="知识 "
           href="/2020/01/08/%E7%9F%A5%E8%AF%86-2020-1-8-%E7%9F%A5%E8%AF%86/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="知识">知识</span>
            <span class="post-date" title="2020-01-08 11:07:28">2020/01/08</span>
        </a>
        
        <a  class="知识 "
           href="/2020/04/14/%E7%9F%A5%E8%AF%86-2020-4-14-%E7%88%B1%E5%A5%BD%E5%88%97%E8%A1%A8/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="爱好列表">爱好列表</span>
            <span class="post-date" title="2020-04-14 00:00:00">2020/04/14</span>
        </a>
        
        <a  class="安装 "
           href="/2020/08/18/%E5%AE%89%E8%A3%85-2020-8-18-%E5%9B%BE%E7%89%87%E8%BD%ACPDF%E5%B7%A5%E5%85%B7/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="图片转PDF工具">图片转PDF工具</span>
            <span class="post-date" title="2020-08-18 00:00:00">2020/08/18</span>
        </a>
        
        <a  class="demo 知识 demo "
           href="/2020/07/31/%E7%9F%A5%E8%AF%86-2020-7-31-%E6%89%8B%E6%9C%BA%E5%90%84%E8%BD%AF%E4%BB%B6%E7%9B%AE%E5%BD%95/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="手机各软件目录">手机各软件目录</span>
            <span class="post-date" title="2020-07-31 00:00:00">2020/07/31</span>
        </a>
        
        <a  class="问题 "
           href="/2020/03/27/%E9%97%AE%E9%A2%98-2020-3-27-module-named-past/"
           data-tag="python"
           data-author="" >
            <span class="post-title" title="no module named &#39;past&#39;">no module named &#39;past&#39;</span>
            <span class="post-date" title="2020-03-27 00:00:00">2020/03/27</span>
        </a>
        
        <a  class="问题 VS "
           href="/2020/04/16/%E9%97%AE%E9%A2%98-2020-4-16-VS%E8%BD%AF%E4%BB%B6C1083%E9%94%99%E8%AF%AF/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="VS软件C1083错误">VS软件C1083错误</span>
            <span class="post-date" title="2020-04-16 14:17:31">2020/04/16</span>
        </a>
        
        <a  class="知识 "
           href="/2020/07/29/%E7%9F%A5%E8%AF%86-2020-7-29-IKBC%E9%94%AE%E7%9B%98%E4%BD%BF%E7%94%A8/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="IKBC F108键盘使用">IKBC F108键盘使用</span>
            <span class="post-date" title="2020-07-29 00:00:00">2020/07/29</span>
        </a>
        
        <a  class="问题 QT "
           href="/2024/02/26/%E9%97%AE%E9%A2%98-2023-06-20-QT%E9%97%AE%E9%A2%98/"
           data-tag="QT,问题"
           data-author="" >
            <span class="post-title" title="QT问题">QT问题</span>
            <span class="post-date" title="2024-02-26 21:24:50">2024/02/26</span>
        </a>
        
        <a  class="IT QT "
           href="/2024/02/26/IT-2023-6-25-Qt-Console-Application%E7%AE%80%E5%8D%95%E4%BE%8B%E7%A8%8B/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="Qt-Console-Application简单例程">Qt-Console-Application简单例程</span>
            <span class="post-date" title="2024-02-26 21:24:50">2024/02/26</span>
        </a>
        
        <a  class="IT QT "
           href="/2024/02/26/IT-2023-07-01-QT-Android%E7%8E%AF%E5%A2%83%E5%AE%8C%E6%95%B4%E5%AE%89%E8%A3%85/"
           data-tag="QT,Android,安装"
           data-author="" >
            <span class="post-title" title="QT-Android环境完整安装">QT-Android环境完整安装</span>
            <span class="post-date" title="2024-02-26 21:24:50">2024/02/26</span>
        </a>
        
        <a  class="问题 "
           href="/2024/03/21/%E9%97%AE%E9%A2%98-2024-03-21-gradio%E9%97%AE%E9%A2%98/"
           data-tag="问题"
           data-author="" >
            <span class="post-title" title="gradio问题">gradio问题</span>
            <span class="post-date" title="2024-03-21 08:57:24">2024/03/21</span>
        </a>
        
        <a  class="AI 框架 "
           href="/2024/03/20/AI-%E6%A1%86%E6%9E%B6-2024-03-20-ChatGLM2%E5%AE%89%E8%A3%85/"
           data-tag="AI,模型,本地"
           data-author="" >
            <span class="post-title" title="ChatGLM2安装">ChatGLM2安装</span>
            <span class="post-date" title="2024-03-20 23:26:48">2024/03/20</span>
        </a>
        
        <a  class="AI 框架 "
           href="/2020/02/04/AI-%E6%A1%86%E6%9E%B6-2020-2-4-mmdetection%E5%AE%89%E8%A3%85/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="mmdetection安装">mmdetection安装</span>
            <span class="post-date" title="2020-02-04 11:53:07">2020/02/04</span>
        </a>
        
        <a  class="AI 框架 "
           href="/2024/03/22/AI-%E6%A1%86%E6%9E%B6-2024-03-22-whisper/"
           data-tag="AI,框架,模型"
           data-author="" >
            <span class="post-title" title="2024-03-22-whisper">2024-03-22-whisper</span>
            <span class="post-date" title="2024-03-22 19:55:07">2024/03/22</span>
        </a>
        
        <a  class="IT 编译 "
           href="/2024/03/22/IT-%E7%BC%96%E8%AF%91-2024-03-22-Python%E7%BC%96%E8%AF%91/"
           data-tag="编译"
           data-author="" >
            <span class="post-title" title="Python编译">Python编译</span>
            <span class="post-date" title="2024-03-22 16:28:55">2024/03/22</span>
        </a>
        
        <a  class="IT 编译 "
           href="/2024/03/23/IT-%E7%BC%96%E8%AF%91-2024-03-23-openssl%E7%BC%96%E8%AF%91/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="openssl">openssl</span>
            <span class="post-date" title="2024-03-23 00:00:10">2024/03/23</span>
        </a>
        
        <a  class="IT python "
           href="/2019/12/30/IT-2019-12-30-Python%E5%B8%B8%E7%94%A8%E5%8C%85/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="Python常用包">Python常用包</span>
            <span class="post-date" title="2019-12-30 16:49:44">2019/12/30</span>
        </a>
        
        <a  class="obsidian 使用 内容 "
           href="/2024/02/26/obsidian-2022-03-23-obsidian/"
           data-tag="obsidian"
           data-author="" >
            <span class="post-title" title="obsidian">obsidian</span>
            <span class="post-date" title="2024-02-26 21:24:50">2024/02/26</span>
        </a>
        
        <a  class="obsidian "
           href="/2022/09/01/obsidian-2022-9-1-obsidianPC%E7%89%88%E6%9C%AC%E4%B8%8B%E8%BD%BD/"
           data-tag="下载,obsidian,软件"
           data-author="" >
            <span class="post-title" title="obsidianPC版本下载">obsidianPC版本下载</span>
            <span class="post-date" title="2022-09-01 00:00:00">2022/09/01</span>
        </a>
        
        <a  class="obsidian "
           href="/2022/09/01/obsidian-2022-9-1-obsidian%E5%AE%89%E5%8D%93%E7%89%88%E6%9C%AC%E4%B8%8B%E8%BD%BD/"
           data-tag="下载,obsidian,软件,安卓"
           data-author="" >
            <span class="post-title" title="obsidian安卓版本下载">obsidian安卓版本下载</span>
            <span class="post-date" title="2022-09-01 00:00:00">2022/09/01</span>
        </a>
        
        <a  class="使用 "
           href="/2019/10/08/%E4%BD%BF%E7%94%A8-2019-10-8-%E7%BC%96%E8%AF%91/"
           data-tag="Opencv 编译"
           data-author="" >
            <span class="post-title" title="OpenCV编译">OpenCV编译</span>
            <span class="post-date" title="2019-10-08 00:00:00">2019/10/08</span>
        </a>
        
        <a  class="使用 "
           href="/2019/12/30/%E4%BD%BF%E7%94%A8-2019-12-30-hexo/"
           data-tag=""
           data-author="" >
            <span class="post-title" title="hexo安装与使用教程">hexo安装与使用教程</span>
            <span class="post-date" title="2019-12-30 15:10:18">2019/12/30</span>
        </a>
        
        <a  class="使用 "
           href="/2020/03/19/%E4%BD%BF%E7%94%A8-2020-3-19-conda%E5%B8%B8%E7%94%A8%E7%8E%AF%E5%A2%83%E5%AE%89%E8%A3%85/"
           data-tag="conda"
           data-author="" >
            <span class="post-title" title="conda常用环境安装">conda常用环境安装</span>
            <span class="post-date" title="2020-03-19 11:01:04">2020/03/19</span>
        </a>
        
        <a  class="学习 C加加 "
           href="/2020/04/18/%E5%AD%A6%E4%B9%A0-2020-4-18-c-%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0-%E5%BC%82%E5%B8%B8%E5%A4%84%E7%90%86/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="C++学习笔记-异常处理">C++学习笔记-异常处理</span>
            <span class="post-date" title="2020-04-18 00:00:00">2020/04/18</span>
        </a>
        
        <a  class="问题 "
           href="/2024/03/23/%E9%97%AE%E9%A2%98-2024-03-23-Python%E9%97%AE%E9%A2%98/"
           data-tag="问题"
           data-author="" >
            <span class="post-title" title="Python问题">Python问题</span>
            <span class="post-date" title="2024-03-23 09:26:04">2024/03/23</span>
        </a>
        
        <a  class="知识 "
           href="/2020/01/03/%E7%9F%A5%E8%AF%86-2020-1-3-MarkDown%E8%AF%AD%E6%B3%95%E6%A0%BC%E5%BC%8F/"
           data-tag=""
           data-author="" >
            <span class="post-title" title="Markdown语法格式">Markdown语法格式</span>
            <span class="post-date" title="2020-01-03 17:05:53">2020/01/03</span>
        </a>
        
        <a  class="AI 框架 "
           href="/2024/03/23/AI-%E6%A1%86%E6%9E%B6-2024-03-23-yolov5/"
           data-tag="AI,框架,模型"
           data-author="" >
            <span class="post-title" title="yolov5">yolov5</span>
            <span class="post-date" title="2024-03-23 16:48:43">2024/03/23</span>
        </a>
        
        <a  class="IT "
           href="/2024/03/24/IT-2024-03-24-%E5%90%84%E7%A7%8D%E8%AF%AD%E8%A8%80%E7%9A%84%E7%A4%BA%E4%BE%8B/"
           data-tag="编程语言,C语言,C加加,Python,ncnn,OpenCV"
           data-author="" >
            <span class="post-title" title="各种语言的示例">各种语言的示例</span>
            <span class="post-date" title="2024-03-24 17:57:55">2024/03/24</span>
        </a>
        
        <a  class="问题 "
           href="/2024/03/24/%E9%97%AE%E9%A2%98-2024-03-24-cmake%E9%97%AE%E9%A2%98/"
           data-tag="问题"
           data-author="" >
            <span class="post-title" title="cmake问题">cmake问题</span>
            <span class="post-date" title="2024-03-24 16:55:26">2024/03/24</span>
        </a>
        
        <a  class="IT 编译 "
           href="/2024/03/24/IT-%E7%BC%96%E8%AF%91-2024-03-24-cmake-Linux%E7%BC%96%E8%AF%91%E5%AE%89%E8%A3%85/"
           data-tag="Linux,编译"
           data-author="" >
            <span class="post-title" title="cmake-Linux编译安装">cmake-Linux编译安装</span>
            <span class="post-date" title="2024-03-24 13:34:38">2024/03/24</span>
        </a>
        
        <a  class="IT 编译 "
           href="/2024/03/24/IT-%E7%BC%96%E8%AF%91-2024-03-24-advcpmv/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="advcpmv">advcpmv</span>
            <span class="post-date" title="2024-03-24 18:50:36">2024/03/24</span>
        </a>
        
        <a  class="问题 "
           href="/2024/03/25/%E9%97%AE%E9%A2%98-2024-03-25-LLVM%E9%97%AE%E9%A2%98/"
           data-tag="问题"
           data-author="" >
            <span class="post-title" title="LLVM">LLVM</span>
            <span class="post-date" title="2024-03-25 08:55:32">2024/03/25</span>
        </a>
        
        <a  class="AI "
           href="/2024/03/28/AI-2024-03-28-%E9%A6%99%E6%A9%99%E6%B4%BE-RKNN-Yolov5/"
           data-tag="部署"
           data-author="" >
            <span class="post-title" title="香橙派-RKNN-Yolov5">香橙派-RKNN-Yolov5</span>
            <span class="post-date" title="2024-03-28 10:36:30">2024/03/28</span>
        </a>
        
        <a  class="demo demo "
           href="/2024/04/01/%E5%AE%89%E8%A3%85-2024-04-01-samba%E5%AE%89%E8%A3%85/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="samba安装">samba安装</span>
            <span class="post-date" title="2024-04-01 16:28:10">2024/04/01</span>
        </a>
        
        <a  class="AI "
           href="/2024/03/30/AI-2024-03-30-%E9%A6%99%E6%A9%99%E6%B4%BE-RKNN-Yolov5-v2/"
           data-tag="部署"
           data-author="" >
            <span class="post-title" title="香橙派-RKNN-Yolov5">香橙派-RKNN-Yolov5</span>
            <span class="post-date" title="2024-03-30 11:59:22">2024/03/30</span>
        </a>
        
        <a  class="demo demo "
           href="/2024/04/01/IT-%E7%BC%96%E8%AF%91-OpenCV%E9%A6%99%E6%A9%99%E6%B4%BE%E7%BC%96%E8%AF%91/"
           data-tag="demo"
           data-author="" >
            <span class="post-title" title="OpenCV香橙派编译">OpenCV香橙派编译</span>
            <span class="post-date" title="2024-04-01 12:02:59">2024/04/01</span>
        </a>
        
        <a  class="AI 框架 "
           href="/2024/04/03/AI-2024-04-03-ollama/"
           data-tag="AI,框架,模型"
           data-author="" >
            <span class="post-title" title="ollama">ollama</span>
            <span class="post-date" title="2024-04-03 09:59:24">2024/04/03</span>
        </a>
        
        <a  class="python "
           href="/2024/04/07/IT-2024-04-07-python%E6%97%A5%E5%BF%97%E8%BE%93%E5%87%BA/"
           data-tag="Python,代码,日志"
           data-author="" >
            <span class="post-title" title="python日志输出">python日志输出</span>
            <span class="post-date" title="2024-04-07 22:03:05">2024/04/07</span>
        </a>
        
        <a  class="AI "
           href="/2024/04/04/AI-2024-04-04-open-webui/"
           data-tag="界面"
           data-author="" >
            <span class="post-title" title="open-webui">open-webui</span>
            <span class="post-date" title="2024-04-04 17:13:26">2024/04/04</span>
        </a>
        
    </nav>
</div>
    </div>
    <div class="hide-list">
        <div class="semicircle">
            <div class="brackets first"><</div>
            <div class="brackets">&gt;</div>
        </div>
    </div>
</aside>
<div class="post">
    <div class="pjax">
        <article id="post-AI-2024-03-30-香橙派-RKNN-Yolov5-v2" class="article article-type-post" itemscope itemprop="blogPost">
    
        <h1 class="article-title">香橙派-RKNN-Yolov5</h1>
    
    <div class="article-meta">
        
        
        
        <span class="book">
            
                <a  data-rel="AI">AI</a>
            
        </span>
        
        
        <span class="tag">
            
            <a class="color3">部署</a>
            
        </span>
        
    </div>
    <div class="article-meta">
        
        创建时间:<time class="date" title='更新时间: 2024-03-30 16:52:57'>2024-03-30 11:59</time>
        
    </div>
    <div class="article-meta">
        
        <span>字数:3.3k</span>
        
        
        <span id="busuanzi_container_page_pv">
            阅读:<span id="busuanzi_value_page_pv">
                <span class="count-comment">
                    <span class="spinner">
                      <div class="cube1"></div>
                      <div class="cube2"></div>
                    </span>
                </span>
            </span>
        </span>
        
        
    </div>
    
    <div class="toc-ref">
    
        <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#香橙派-RKNN-Yolov5"><span class="toc-text">香橙派-RKNN-Yolov5</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#说明"><span class="toc-text">说明</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#RKNN-Toolkit2"><span class="toc-text">RKNN-Toolkit2</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#RKNN-Toolkit-Lite2"><span class="toc-text">RKNN-Toolkit-Lite2</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#RKNN-Runtime"><span class="toc-text">RKNN Runtime</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#RKNPU"><span class="toc-text">RKNPU</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#RKNN-Model-Zoo"><span class="toc-text">RKNN Model Zoo</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#RKNPU2-SDK"><span class="toc-text">RKNPU2_SDK</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#环境说明"><span class="toc-text">环境说明</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#环境说明-1"><span class="toc-text">环境说明</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#所需源码"><span class="toc-text">所需源码</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#RKNN-香橙派-部署"><span class="toc-text">RKNN 香橙派 部署</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#RKNN-1-4-0版本安装"><span class="toc-text">RKNN 1.4.0版本安装</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#RKNN-PC-Linux部署"><span class="toc-text">RKNN PC Linux部署</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#香橙派-运行yolov5"><span class="toc-text">香橙派 运行yolov5</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#帮助文档"><span class="toc-text">帮助文档</span></a></li></ol></li></ol>
    
<style>
    .left-col .switch-btn,
    .left-col .switch-area {
        display: none;
    }
    .toc-level-3 i,
    .toc-level-3 ol {
        display: none !important;
    }
</style>
</div>
    
    <div class="article-entry" itemprop="articleBody">
      
        <h1 id="香橙派-RKNN-Yolov5"><a href="#香橙派-RKNN-Yolov5" class="headerlink" title="香橙派-RKNN-Yolov5"></a>香橙派-RKNN-Yolov5</h1><p><img src="/images/2024-03-28-%E9%A6%99%E6%A9%99%E6%B4%BE-RKNN-Yolov5.png" alt=""></p>
<h2 id="说明"><a href="#说明" class="headerlink" title="说明"></a>说明</h2><h3 id="RKNN-Toolkit2"><a href="#RKNN-Toolkit2" class="headerlink" title="RKNN-Toolkit2"></a>RKNN-Toolkit2</h3><p>RKNN-Toolkit2 是一款软件开发套件，供用户在 PC 和瑞芯微 NPU 平台上进行模型转换、推理和性能评估。</p>
<ul>
<li>旧代码<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">https:&#x2F;&#x2F;github.com&#x2F;rockchip-linux&#x2F;rknn-toolkit2.git</span><br></pre></td></tr></table></figure></li>
<li>新代码<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">https:&#x2F;&#x2F;github.com&#x2F;airockchip&#x2F;rknn-toolkit2</span><br></pre></td></tr></table></figure>

</li>
</ul>
<h3 id="RKNN-Toolkit-Lite2"><a href="#RKNN-Toolkit-Lite2" class="headerlink" title="RKNN-Toolkit-Lite2"></a>RKNN-Toolkit-Lite2</h3><p>RKNN-Toolkit-Lite2为瑞芯微NPU平台提供Python编程接口，帮助用户部署RKNN模型，加速AI应用的实现。</p>
<h3 id="RKNN-Runtime"><a href="#RKNN-Runtime" class="headerlink" title="RKNN Runtime"></a>RKNN Runtime</h3><p>RKNN Runtime为瑞芯微NPU平台提供C/C++编程接口，帮助用户部署RKNN模型，加速AI应用的实现。</p>
<h3 id="RKNPU"><a href="#RKNPU" class="headerlink" title="RKNPU"></a>RKNPU</h3><p>RKNPU 内核驱动程序负责与 NPU 硬件进行交互。它是开源的，可以在瑞芯微内核代码中找到。</p>
<ul>
<li>旧代码<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">https:&#x2F;&#x2F;github.com&#x2F;rockchip-linux&#x2F;rknpu2.git</span><br></pre></td></tr></table></figure></li>
<li>新代码<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">https:&#x2F;&#x2F;github.com&#x2F;airockchip&#x2F;rknpu</span><br></pre></td></tr></table></figure>

</li>
</ul>
<h3 id="RKNN-Model-Zoo"><a href="#RKNN-Model-Zoo" class="headerlink" title="RKNN Model Zoo"></a>RKNN Model Zoo</h3><p>RKNN Model Zoo基于 RKNPU SDK 工具链开发, 提供了目前主流算法的部署例程. 例程包含导出RKNN模型, 使用 Python API, CAPI 推理 RKNN 模型的流程.</p>
<ul>
<li>支持 <code>RK3562</code>, <code>RK3566</code>, <code>RK3568</code>, <code>RK3588</code>, <code>RK3576</code> 平台。</li>
<li>部分支持<code>RV1103</code>, <code>RV1106</code></li>
<li>支持 <code>RK1808</code>, <code>RV1109</code>, <code>RV1126</code> 平台。<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">https:&#x2F;&#x2F;github.com&#x2F;airockchip&#x2F;rknn_model_zoo</span><br></pre></td></tr></table></figure>

</li>
</ul>
<h3 id="RKNPU2-SDK"><a href="#RKNPU2-SDK" class="headerlink" title="RKNPU2_SDK"></a>RKNPU2_SDK</h3><p>您还可以从 RKNPU2_SDK 下载所有包、docker 镜像、示例、文档和平台工具</p>
<h3 id="环境说明"><a href="#环境说明" class="headerlink" title="环境说明"></a>环境说明</h3><blockquote>
<h2 id="环境说明-1"><a href="#环境说明-1" class="headerlink" title="环境说明"></a>环境说明</h2><p>RKNN版本：1.4.0<br>香橙派系统环境：Ubuntu20<br>香橙派python版本：3.7<br>电脑系统环境：Ubuntu20<br>电脑python版本：3.8<br>硬件设备：香橙派5  </p>
</blockquote>
<h3 id="所需源码"><a href="#所需源码" class="headerlink" title="所需源码"></a>所需源码</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">https:&#x2F;&#x2F;github.com&#x2F;ultralytics&#x2F;yolov5.git</span><br></pre></td></tr></table></figure>

<h2 id="RKNN-香橙派-部署"><a href="#RKNN-香橙派-部署" class="headerlink" title="RKNN 香橙派 部署"></a>RKNN 香橙派 部署</h2><ol>
<li><p>代码下载</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">git clone https:&#x2F;&#x2F;github.com&#x2F;rockchip-linux&#x2F;rknn-toolkit2.git</span><br><span class="line">git checkout v1.6.0</span><br></pre></td></tr></table></figure></li>
<li><p>查看RKNN 1.6.0版本支持的python版本</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">ls rknn_toolkit_lite2&#x2F;packages</span><br><span class="line"># 结果 </span><br><span class="line">rknn_toolkit_lite2-1.6.0-cp310-cp310-linux_aarch64.whl  </span><br><span class="line">rknn_toolkit_lite2-1.6.0-cp37-cp37m-linux_aarch64.whl  </span><br><span class="line">rknn_toolkit_lite2-1.6.0-cp39-cp39-linux_aarch64.whl</span><br><span class="line">rknn_toolkit_lite2-1.6.0-cp311-cp311-linux_aarch64.whl  </span><br><span class="line">rknn_toolkit_lite2-1.6.0-cp38-cp38-linux_aarch64.whl   </span><br><span class="line">rknn_toolkit_lite2_1.6.0_packages.md5sum</span><br></pre></td></tr></table></figure>
<p>我们可以使用python 3.7 到 3.11之间的任何版本。</p>
</li>
<li><p>安装python 3.7</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">conda create -n py37 python&#x3D;3.7</span><br><span class="line">conda activate py37</span><br><span class="line">pip install rknn_toolkit_lite2&#x2F;packages&#x2F;rknn_toolkit_lite2-1.6.0-cp37-cp37m-linux_aarch64.whl --index-url https:&#x2F;&#x2F;mirror.baidu.com&#x2F;pypi&#x2F;simple</span><br><span class="line">pip install opencv-python</span><br></pre></td></tr></table></figure></li>
<li><p>运行测试程序</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">cd rknn_toolkit_lite2&#x2F;examples&#x2F;dynamic_shape</span><br><span class="line">python test.py</span><br></pre></td></tr></table></figure></li>
<li><p>运行结果</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">--&gt; Load RKNN model</span><br><span class="line">done</span><br><span class="line">--&gt; Init runtime environment</span><br><span class="line">I RKNN: [11:16:18.618] RKNN Runtime Information: librknnrt version: 1.4.0 (a10f100eb@2022-09-09T09:07:14)</span><br><span class="line">I RKNN: [11:16:18.618] RKNN Driver Information: version: 0.8.2</span><br><span class="line">E RKNN: [11:16:18.618] 6, 1</span><br><span class="line">E RKNN: [11:16:18.618] Invalid RKNN model version 6</span><br><span class="line">E RKNN: [11:16:18.618] rknn_init, load model failed!</span><br><span class="line">E Catch exception when init runtime!</span><br><span class="line">E Traceback (most recent call last):</span><br><span class="line">  File &quot;&#x2F;opt&#x2F;conda&#x2F;envs&#x2F;py37&#x2F;lib&#x2F;python3.7&#x2F;site-packages&#x2F;rknnlite&#x2F;api&#x2F;rknn_lite.py&quot;, line 148, in init_runtime</span><br><span class="line">    self.rknn_runtime.build_graph(self.rknn_data, self.load_model_in_npu)</span><br><span class="line">  File &quot;rknnlite&#x2F;api&#x2F;rknn_runtime.py&quot;, line 919, in rknnlite.api.rknn_runtime.RKNNRuntime.build_graph</span><br><span class="line">Exception: RKNN init failed. error code: RKNN_ERR_FAIL</span><br><span class="line"></span><br><span class="line">Init runtime environment failed</span><br></pre></td></tr></table></figure>
<p>从运行的结果中<code>librknnrt version: 1.4.0</code>，可以看出。我们的设备支持RKNN的1.4.0的版本<br>接下来，我们就安装RKNN1.4.0的版本。</p>
</li>
</ol>
<h3 id="RKNN-1-4-0版本安装"><a href="#RKNN-1-4-0版本安装" class="headerlink" title="RKNN 1.4.0版本安装"></a>RKNN 1.4.0版本安装</h3><ul>
<li>切换 RKNN 1.4.0版本<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git checkout v1.4.0</span><br></pre></td></tr></table></figure></li>
<li>支持的Python版本查看<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">ls rknn_toolkit_lite2&#x2F;packages</span><br><span class="line">@结果 支持python 3.7与3.9</span><br><span class="line">rknn_toolkit_lite2-1.4.0-cp37-cp37m-linux_aarch64.whl  </span><br><span class="line">rknn_toolkit_lite2-1.4.0-cp39-cp39-linux_aarch64.whl  </span><br><span class="line">rknn_toolkit_lite2_1.4.0_packages.md5sum</span><br></pre></td></tr></table></figure></li>
<li>安装Python3.7环境<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">conda create -n py37 python&#x3D;3.7</span><br><span class="line">conda activate py37</span><br></pre></td></tr></table></figure></li>
<li>安装rknn-toolkit_lite2<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">pip install rknn_toolkit_lite2&#x2F;packages&#x2F;rknn_toolkit_lite2-1.4.0-cp37-cp37m-linux_aarch64.whl --index-url https:&#x2F;&#x2F;mirror.baidu.com&#x2F;pypi&#x2F;simple</span><br><span class="line">pip install opencv-python</span><br></pre></td></tr></table></figure></li>
<li>测试安装效果<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"># 没有出现报错，则安装成功</span><br><span class="line">python -c &quot;from rknnlite.api import RKNNLite&quot;</span><br></pre></td></tr></table></figure>

</li>
</ul>
<h2 id="RKNN-PC-Linux部署"><a href="#RKNN-PC-Linux部署" class="headerlink" title="RKNN PC Linux部署"></a>RKNN PC Linux部署</h2><p>由于香橙派上只能用1.4.0的版本，电脑上也用1.4.0的版本</p>
<ol start="0">
<li>安装RKNN-Toolkit的软件依赖<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt-get install libxslt1-dev zlib1g-dev libglib2.0 libsm6 libgl1-mesa-glx libprotobuf-dev gcc</span><br></pre></td></tr></table></figure></li>
<li>下载指定tag的代码<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">git clone https:&#x2F;&#x2F;github.com&#x2F;rockchip-linux&#x2F;rknn-toolkit2.git</span><br><span class="line">git checkout v1.4.0</span><br></pre></td></tr></table></figure></li>
<li>查看RKNN 1.6.0版本支持的python版本<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">ls packages&#x2F;</span><br><span class="line"># 结果 </span><br><span class="line">md5sum.txt  </span><br><span class="line">rknn_toolkit2-1.4.0_22dcfef4-cp36-cp36m-linux_x86_64.whl  </span><br><span class="line">rknn_toolkit2-1.4.0_22dcfef4-cp38-cp38-linux_x86_64.whl</span><br></pre></td></tr></table></figure>
我们可以使用python 3.6 和 3.8的版本。  </li>
<li>创建Python3.8的环境<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">conda create -n py38 python&#x3D;3.8</span><br><span class="line">conda activate py38</span><br></pre></td></tr></table></figure></li>
<li>安装rknn_toolkit2<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pip install packages&#x2F;rknn_toolkit2-1.4.0_22dcfef4-cp38-cp38-linux_x86_64.whl --index-url https:&#x2F;&#x2F;mirror.baidu.com&#x2F;pypi&#x2F;simple</span><br></pre></td></tr></table></figure></li>
<li>运行yolov5例程<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line">cd examples&#x2F;onnx&#x2F;yolov5</span><br><span class="line">python test.py</span><br><span class="line"># 结果</span><br><span class="line">--&gt; Export rknn model</span><br><span class="line">done</span><br><span class="line">--&gt; Init runtime environment</span><br><span class="line">W init_runtime: Target is None, use simulator!</span><br><span class="line">done</span><br><span class="line">--&gt; Running model</span><br><span class="line">Analysing : 100%|███████████████████████████████████████████████| 146&#x2F;146 [00:00&lt;00:00, 5137.71it&#x2F;s]</span><br><span class="line">Preparing : 100%|███████████████████████████████████████████████| 146&#x2F;146 [00:00&lt;00:00, 1165.36it&#x2F;s]</span><br><span class="line">W inference: The dims of input(ndarray) shape (640, 640, 3) is wrong, expect dims is 4! Try expand dims to (1, 640, 640, 3)!</span><br><span class="line">done</span><br><span class="line">class: person, score: 0.8223356008529663</span><br><span class="line">box coordinate left,top,right,down: [473.26745200157166, 231.93780636787415, 562.1268351078033, 519.7597033977509]</span><br><span class="line">class: person, score: 0.817978024482727</span><br><span class="line">box coordinate left,top,right,down: [211.9896697998047, 245.0290389060974, 283.70787048339844, 513.9374527931213]</span><br><span class="line">class: person, score: 0.7971192598342896</span><br><span class="line">box coordinate left,top,right,down: [115.24964022636414, 232.44154334068298, 207.7837154865265, 546.1097872257233]</span><br><span class="line">class: person, score: 0.4627230763435364</span><br><span class="line">box coordinate left,top,right,down: [79.09242534637451, 339.18042743206024, 121.60038471221924, 514.234916806221]</span><br><span class="line">class: bus , score: 0.7545359134674072</span><br><span class="line">box coordinate left,top,right,down: [86.41703361272812, 134.41848754882812, 558.1083570122719, 460.4184875488281]</span><br></pre></td></tr></table></figure>
目录下的<code>yolov5s.rknn</code>就是最后生成的模型。  </li>
<li>适配3588模型<br>%%<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"># 239行</span><br><span class="line">rknn &#x3D; RKNN(verbose&#x3D;True)</span><br><span class="line">替换为</span><br><span class="line">rknn &#x3D; RKNN()</span><br></pre></td></tr></table></figure>
%%<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"># 243行</span><br><span class="line">rknn.config(mean_values&#x3D;[128, 128, 128], std_values&#x3D;[128, 128, 128])</span><br><span class="line">替换为</span><br><span class="line">rknn.config(mean_values&#x3D;[128, 128, 128], std_values&#x3D;[128, 128, 128], target_platform&#x3D;&#39;rk3588&#39;)</span><br></pre></td></tr></table></figure>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"># 272行</span><br><span class="line">ret &#x3D; rknn.init_runtime()</span><br><span class="line">替换为</span><br><span class="line">ret &#x3D; rknn.init_runtime(target&#x3D;&#39;rk3588&#39;)</span><br></pre></td></tr></table></figure></li>
<li>运行test.py，生成yolov5s.rknn<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">python test.py</span><br><span class="line"># 结果</span><br><span class="line">done</span><br><span class="line">--&gt; Export rknn model</span><br><span class="line">done</span><br><span class="line">--&gt; Init runtime environment</span><br><span class="line">I target set by user is: rk3588</span><br><span class="line">I Starting ntp or adb, target is RK3588</span><br><span class="line">I Start adb...</span><br><span class="line">error: no devices&#x2F;emulators found</span><br><span class="line">E init_runtime: Connect to Device Failure (-1), Please make sure the USB connection is normal!</span><br><span class="line">E init_runtime: Catch exception when init runtime!</span><br><span class="line">E init_runtime: Traceback (most recent call last):</span><br><span class="line">E init_runtime:   File &quot;rknn&#x2F;api&#x2F;rknn_base.py&quot;, line 1975, in rknn.api.rknn_base.RKNNBase.init_runtime</span><br><span class="line">E init_runtime:   File &quot;rknn&#x2F;api&#x2F;rknn_runtime.py&quot;, line 194, in rknn.api.rknn_runtime.RKNNRuntime.__init__</span><br><span class="line">E init_runtime:   File &quot;rknn&#x2F;api&#x2F;rknn_platform.py&quot;, line 331, in rknn.api.rknn_platform.start_ntp_or_adb</span><br><span class="line">E init_runtime: Exception: Init runtime environment failed!</span><br><span class="line">Init runtime environment failed!</span><br></pre></td></tr></table></figure></li>
<li>将yolov5s.rknn传到香橙派上</li>
</ol>
<h2 id="香橙派-运行yolov5"><a href="#香橙派-运行yolov5" class="headerlink" title="香橙派 运行yolov5"></a>香橙派 运行yolov5</h2><ol>
<li>建立文件<code>deploy.py</code>，将下面的内容写入文件中。<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br></pre></td><td class="code"><pre><span class="line">import numpy as np</span><br><span class="line">import cv2</span><br><span class="line">from rknnlite.api import RKNNLite</span><br><span class="line"></span><br><span class="line">RKNN_MODEL &#x3D; &#39;yolov5s.rknn&#39;</span><br><span class="line">IMG_PATH &#x3D; &quot;bus.jpg&quot;</span><br><span class="line"></span><br><span class="line">QUANTIZE_ON &#x3D; True</span><br><span class="line"></span><br><span class="line">OBJ_THRESH &#x3D; 0.25</span><br><span class="line">NMS_THRESH &#x3D; 0.45</span><br><span class="line">IMG_SIZE &#x3D; 640</span><br><span class="line"></span><br><span class="line">CLASSES &#x3D; (&quot;person&quot;, &quot;bicycle&quot;, &quot;car&quot;, &quot;motorbike &quot;, &quot;aeroplane &quot;, &quot;bus &quot;, &quot;train&quot;, &quot;truck &quot;, &quot;boat&quot;, &quot;traffic light&quot;,</span><br><span class="line">           &quot;fire hydrant&quot;, &quot;stop sign &quot;, &quot;parking meter&quot;, &quot;bench&quot;, &quot;bird&quot;, &quot;cat&quot;, &quot;dog &quot;, &quot;horse &quot;, &quot;sheep&quot;, &quot;cow&quot;, &quot;elephant&quot;,</span><br><span class="line">           &quot;bear&quot;, &quot;zebra &quot;, &quot;giraffe&quot;, &quot;backpack&quot;, &quot;umbrella&quot;, &quot;handbag&quot;, &quot;tie&quot;, &quot;suitcase&quot;, &quot;frisbee&quot;, &quot;skis&quot;, &quot;snowboard&quot;, &quot;sports ball&quot;, &quot;kite&quot;,</span><br><span class="line">           &quot;baseball bat&quot;, &quot;baseball glove&quot;, &quot;skateboard&quot;, &quot;surfboard&quot;, &quot;tennis racket&quot;, &quot;bottle&quot;, &quot;wine glass&quot;, &quot;cup&quot;, &quot;fork&quot;, &quot;knife &quot;,</span><br><span class="line">           &quot;spoon&quot;, &quot;bowl&quot;, &quot;banana&quot;, &quot;apple&quot;, &quot;sandwich&quot;, &quot;orange&quot;, &quot;broccoli&quot;, &quot;carrot&quot;, &quot;hot dog&quot;, &quot;pizza &quot;, &quot;donut&quot;, &quot;cake&quot;, &quot;chair&quot;, &quot;sofa&quot;,</span><br><span class="line">           &quot;pottedplant&quot;, &quot;bed&quot;, &quot;diningtable&quot;, &quot;toilet &quot;, &quot;tvmonitor&quot;, &quot;laptop	&quot;, &quot;mouse	&quot;, &quot;remote &quot;, &quot;keyboard &quot;, &quot;cell phone&quot;, &quot;microwave &quot;,</span><br><span class="line">           &quot;oven &quot;, &quot;toaster&quot;, &quot;sink&quot;, &quot;refrigerator &quot;, &quot;book&quot;, &quot;clock&quot;, &quot;vase&quot;, &quot;scissors &quot;, &quot;teddy bear &quot;, &quot;hair drier&quot;, &quot;toothbrush &quot;)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">def sigmoid(x):</span><br><span class="line">    return 1 &#x2F; (1 + np.exp(-x))</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">def xywh2xyxy(x):</span><br><span class="line">    # Convert [x, y, w, h] to [x1, y1, x2, y2]</span><br><span class="line">    y &#x3D; np.copy(x)</span><br><span class="line">    y[:, 0] &#x3D; x[:, 0] - x[:, 2] &#x2F; 2  # top left x</span><br><span class="line">    y[:, 1] &#x3D; x[:, 1] - x[:, 3] &#x2F; 2  # top left y</span><br><span class="line">    y[:, 2] &#x3D; x[:, 0] + x[:, 2] &#x2F; 2  # bottom right x</span><br><span class="line">    y[:, 3] &#x3D; x[:, 1] + x[:, 3] &#x2F; 2  # bottom right y</span><br><span class="line">    return y</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">def process(input, mask, anchors):</span><br><span class="line"></span><br><span class="line">    anchors &#x3D; [anchors[i] for i in mask]</span><br><span class="line">    grid_h, grid_w &#x3D; map(int, input.shape[0:2])</span><br><span class="line"></span><br><span class="line">    box_confidence &#x3D; sigmoid(input[..., 4])</span><br><span class="line">    box_confidence &#x3D; np.expand_dims(box_confidence, axis&#x3D;-1)</span><br><span class="line"></span><br><span class="line">    box_class_probs &#x3D; sigmoid(input[..., 5:])</span><br><span class="line"></span><br><span class="line">    box_xy &#x3D; sigmoid(input[..., :2])*2 - 0.5</span><br><span class="line"></span><br><span class="line">    col &#x3D; np.tile(np.arange(0, grid_w), grid_w).reshape(-1, grid_w)</span><br><span class="line">    row &#x3D; np.tile(np.arange(0, grid_h).reshape(-1, 1), grid_h)</span><br><span class="line">    col &#x3D; col.reshape(grid_h, grid_w, 1, 1).repeat(3, axis&#x3D;-2)</span><br><span class="line">    row &#x3D; row.reshape(grid_h, grid_w, 1, 1).repeat(3, axis&#x3D;-2)</span><br><span class="line">    grid &#x3D; np.concatenate((col, row), axis&#x3D;-1)</span><br><span class="line">    box_xy +&#x3D; grid</span><br><span class="line">    box_xy *&#x3D; int(IMG_SIZE&#x2F;grid_h)</span><br><span class="line"></span><br><span class="line">    box_wh &#x3D; pow(sigmoid(input[..., 2:4])*2, 2)</span><br><span class="line">    box_wh &#x3D; box_wh * anchors</span><br><span class="line"></span><br><span class="line">    box &#x3D; np.concatenate((box_xy, box_wh), axis&#x3D;-1)</span><br><span class="line"></span><br><span class="line">    return box, box_confidence, box_class_probs</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">def filter_boxes(boxes, box_confidences, box_class_probs):</span><br><span class="line">    &quot;&quot;&quot;Filter boxes with box threshold. It&#39;s a bit different with origin yolov5 post process!</span><br><span class="line"></span><br><span class="line">    # Arguments</span><br><span class="line">        boxes: ndarray, boxes of objects.</span><br><span class="line">        box_confidences: ndarray, confidences of objects.</span><br><span class="line">        box_class_probs: ndarray, class_probs of objects.</span><br><span class="line"></span><br><span class="line">    # Returns</span><br><span class="line">        boxes: ndarray, filtered boxes.</span><br><span class="line">        classes: ndarray, classes for boxes.</span><br><span class="line">        scores: ndarray, scores for boxes.</span><br><span class="line">    &quot;&quot;&quot;</span><br><span class="line">    boxes &#x3D; boxes.reshape(-1, 4)</span><br><span class="line">    box_confidences &#x3D; box_confidences.reshape(-1)</span><br><span class="line">    box_class_probs &#x3D; box_class_probs.reshape(-1, box_class_probs.shape[-1])</span><br><span class="line"></span><br><span class="line">    _box_pos &#x3D; np.where(box_confidences &gt;&#x3D; OBJ_THRESH)</span><br><span class="line">    boxes &#x3D; boxes[_box_pos]</span><br><span class="line">    box_confidences &#x3D; box_confidences[_box_pos]</span><br><span class="line">    box_class_probs &#x3D; box_class_probs[_box_pos]</span><br><span class="line"></span><br><span class="line">    class_max_score &#x3D; np.max(box_class_probs, axis&#x3D;-1)</span><br><span class="line">    classes &#x3D; np.argmax(box_class_probs, axis&#x3D;-1)</span><br><span class="line">    _class_pos &#x3D; np.where(class_max_score &gt;&#x3D; OBJ_THRESH)</span><br><span class="line"></span><br><span class="line">    boxes &#x3D; boxes[_class_pos]</span><br><span class="line">    classes &#x3D; classes[_class_pos]</span><br><span class="line">    scores &#x3D; (class_max_score* box_confidences)[_class_pos]</span><br><span class="line"></span><br><span class="line">    return boxes, classes, scores</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">def nms_boxes(boxes, scores):</span><br><span class="line">    &quot;&quot;&quot;Suppress non-maximal boxes.</span><br><span class="line"></span><br><span class="line">    # Arguments</span><br><span class="line">        boxes: ndarray, boxes of objects.</span><br><span class="line">        scores: ndarray, scores of objects.</span><br><span class="line"></span><br><span class="line">    # Returns</span><br><span class="line">        keep: ndarray, index of effective boxes.</span><br><span class="line">    &quot;&quot;&quot;</span><br><span class="line">    x &#x3D; boxes[:, 0]</span><br><span class="line">    y &#x3D; boxes[:, 1]</span><br><span class="line">    w &#x3D; boxes[:, 2] - boxes[:, 0]</span><br><span class="line">    h &#x3D; boxes[:, 3] - boxes[:, 1]</span><br><span class="line"></span><br><span class="line">    areas &#x3D; w * h</span><br><span class="line">    order &#x3D; scores.argsort()[::-1]</span><br><span class="line"></span><br><span class="line">    keep &#x3D; []</span><br><span class="line">    while order.size &gt; 0:</span><br><span class="line">        i &#x3D; order[0]</span><br><span class="line">        keep.append(i)</span><br><span class="line"></span><br><span class="line">        xx1 &#x3D; np.maximum(x[i], x[order[1:]])</span><br><span class="line">        yy1 &#x3D; np.maximum(y[i], y[order[1:]])</span><br><span class="line">        xx2 &#x3D; np.minimum(x[i] + w[i], x[order[1:]] + w[order[1:]])</span><br><span class="line">        yy2 &#x3D; np.minimum(y[i] + h[i], y[order[1:]] + h[order[1:]])</span><br><span class="line"></span><br><span class="line">        w1 &#x3D; np.maximum(0.0, xx2 - xx1 + 0.00001)</span><br><span class="line">        h1 &#x3D; np.maximum(0.0, yy2 - yy1 + 0.00001)</span><br><span class="line">        inter &#x3D; w1 * h1</span><br><span class="line"></span><br><span class="line">        ovr &#x3D; inter &#x2F; (areas[i] + areas[order[1:]] - inter)</span><br><span class="line">        inds &#x3D; np.where(ovr &lt;&#x3D; NMS_THRESH)[0]</span><br><span class="line">        order &#x3D; order[inds + 1]</span><br><span class="line">    keep &#x3D; np.array(keep)</span><br><span class="line">    return keep</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">def yolov5_post_process(input_data):</span><br><span class="line">    masks &#x3D; [[0, 1, 2], [3, 4, 5], [6, 7, 8]]</span><br><span class="line">    anchors &#x3D; [[10, 13], [16, 30], [33, 23], [30, 61], [62, 45],</span><br><span class="line">               [59, 119], [116, 90], [156, 198], [373, 326]]</span><br><span class="line"></span><br><span class="line">    boxes, classes, scores &#x3D; [], [], []</span><br><span class="line">    for input, mask in zip(input_data, masks):</span><br><span class="line">        b, c, s &#x3D; process(input, mask, anchors)</span><br><span class="line">        b, c, s &#x3D; filter_boxes(b, c, s)</span><br><span class="line">        boxes.append(b)</span><br><span class="line">        classes.append(c)</span><br><span class="line">        scores.append(s)</span><br><span class="line"></span><br><span class="line">    boxes &#x3D; np.concatenate(boxes)</span><br><span class="line">    boxes &#x3D; xywh2xyxy(boxes)</span><br><span class="line">    classes &#x3D; np.concatenate(classes)</span><br><span class="line">    scores &#x3D; np.concatenate(scores)</span><br><span class="line"></span><br><span class="line">    nboxes, nclasses, nscores &#x3D; [], [], []</span><br><span class="line">    for c in set(classes):</span><br><span class="line">        inds &#x3D; np.where(classes &#x3D;&#x3D; c)</span><br><span class="line">        b &#x3D; boxes[inds]</span><br><span class="line">        c &#x3D; classes[inds]</span><br><span class="line">        s &#x3D; scores[inds]</span><br><span class="line"></span><br><span class="line">        keep &#x3D; nms_boxes(b, s)</span><br><span class="line"></span><br><span class="line">        nboxes.append(b[keep])</span><br><span class="line">        nclasses.append(c[keep])</span><br><span class="line">        nscores.append(s[keep])</span><br><span class="line"></span><br><span class="line">    if not nclasses and not nscores:</span><br><span class="line">        return None, None, None</span><br><span class="line"></span><br><span class="line">    boxes &#x3D; np.concatenate(nboxes)</span><br><span class="line">    classes &#x3D; np.concatenate(nclasses)</span><br><span class="line">    scores &#x3D; np.concatenate(nscores)</span><br><span class="line"></span><br><span class="line">    return boxes, classes, scores</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">def draw(image, boxes, scores, classes):</span><br><span class="line">    &quot;&quot;&quot;Draw the boxes on the image.</span><br><span class="line"></span><br><span class="line">    # Argument:</span><br><span class="line">        image: original image.</span><br><span class="line">        boxes: ndarray, boxes of objects.</span><br><span class="line">        classes: ndarray, classes of objects.</span><br><span class="line">        scores: ndarray, scores of objects.</span><br><span class="line">        all_classes: all classes name.</span><br><span class="line">    &quot;&quot;&quot;</span><br><span class="line">    for box, score, cl in zip(boxes, scores, classes):</span><br><span class="line">        top, left, right, bottom &#x3D; box</span><br><span class="line">        print(&#39;class: &#123;&#125;, score: &#123;&#125;&#39;.format(CLASSES[cl], score))</span><br><span class="line">        print(&#39;box coordinate left,top,right,down: [&#123;&#125;, &#123;&#125;, &#123;&#125;, &#123;&#125;]&#39;.format(top, left, right, bottom))</span><br><span class="line">        top &#x3D; int(top)</span><br><span class="line">        left &#x3D; int(left)</span><br><span class="line">        right &#x3D; int(right)</span><br><span class="line">        bottom &#x3D; int(bottom)</span><br><span class="line"></span><br><span class="line">        cv2.rectangle(image, (top, left), (right, bottom), (255, 0, 0), 2)</span><br><span class="line">        cv2.putText(image, &#39;&#123;0&#125; &#123;1:.2f&#125;&#39;.format(CLASSES[cl], score),</span><br><span class="line">                    (top, left - 6),</span><br><span class="line">                    cv2.FONT_HERSHEY_SIMPLEX,</span><br><span class="line">                    0.6, (0, 0, 255), 2)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">def letterbox(im, new_shape&#x3D;(640, 640), color&#x3D;(0, 0, 0)):</span><br><span class="line">    # Resize and pad image while meeting stride-multiple constraints</span><br><span class="line">    shape &#x3D; im.shape[:2]  # current shape [height, width]</span><br><span class="line">    if isinstance(new_shape, int):</span><br><span class="line">        new_shape &#x3D; (new_shape, new_shape)</span><br><span class="line"></span><br><span class="line">    # Scale ratio (new &#x2F; old)</span><br><span class="line">    r &#x3D; min(new_shape[0] &#x2F; shape[0], new_shape[1] &#x2F; shape[1])</span><br><span class="line"></span><br><span class="line">    # Compute padding</span><br><span class="line">    ratio &#x3D; r, r  # width, height ratios</span><br><span class="line">    new_unpad &#x3D; int(round(shape[1] * r)), int(round(shape[0] * r))</span><br><span class="line">    dw, dh &#x3D; new_shape[1] - new_unpad[0], new_shape[0] - new_unpad[1]  # wh padding</span><br><span class="line"></span><br><span class="line">    dw &#x2F;&#x3D; 2  # divide padding into 2 sides</span><br><span class="line">    dh &#x2F;&#x3D; 2</span><br><span class="line"></span><br><span class="line">    if shape[::-1] !&#x3D; new_unpad:  # resize</span><br><span class="line">        im &#x3D; cv2.resize(im, new_unpad, interpolation&#x3D;cv2.INTER_LINEAR)</span><br><span class="line">    top, bottom &#x3D; int(round(dh - 0.1)), int(round(dh + 0.1))</span><br><span class="line">    left, right &#x3D; int(round(dw - 0.1)), int(round(dw + 0.1))</span><br><span class="line">    im &#x3D; cv2.copyMakeBorder(im, top, bottom, left, right, cv2.BORDER_CONSTANT, value&#x3D;color)  # add border</span><br><span class="line">    return im, ratio, (dw, dh)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">if __name__ &#x3D;&#x3D; &#39;__main__&#39;:</span><br><span class="line"></span><br><span class="line">    # Create RKNN object</span><br><span class="line">    rknn &#x3D; RKNNLite()</span><br><span class="line"></span><br><span class="line">    # load RKNN model</span><br><span class="line">    print(&#39;--&gt; Load RKNN model&#39;)</span><br><span class="line">    ret &#x3D; rknn.load_rknn(RKNN_MODEL)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    # Init runtime environment</span><br><span class="line">    print(&#39;--&gt; Init runtime environment&#39;)</span><br><span class="line">    ret &#x3D; rknn.init_runtime(core_mask&#x3D;RKNNLite.NPU_CORE_0_1_2)  #使用0 1 2三个NPU核心</span><br><span class="line">    # ret &#x3D; rknn.init_runtime(&#39;rk3566&#39;)</span><br><span class="line">    if ret !&#x3D; 0:</span><br><span class="line">        print(&#39;Init runtime environment failed!&#39;)</span><br><span class="line">        exit(ret)</span><br><span class="line">    print(&#39;done&#39;)</span><br><span class="line"></span><br><span class="line">    # Set inputs</span><br><span class="line">    img &#x3D; cv2.imread(IMG_PATH)</span><br><span class="line">    # img, ratio, (dw, dh) &#x3D; letterbox(img, new_shape&#x3D;(IMG_SIZE, IMG_SIZE))</span><br><span class="line">    img &#x3D; cv2.cvtColor(img, cv2.COLOR_BGR2RGB)</span><br><span class="line">    img &#x3D; cv2.resize(img, (IMG_SIZE, IMG_SIZE))</span><br><span class="line"></span><br><span class="line">    # Inference</span><br><span class="line">    outputs &#x3D; rknn.inference(inputs&#x3D;[img])</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    # post process</span><br><span class="line">    input0_data &#x3D; outputs[0]</span><br><span class="line">    input1_data &#x3D; outputs[1]</span><br><span class="line">    input2_data &#x3D; outputs[2]</span><br><span class="line"></span><br><span class="line">    input0_data &#x3D; input0_data.reshape([3, -1]+list(input0_data.shape[-2:]))</span><br><span class="line">    input1_data &#x3D; input1_data.reshape([3, -1]+list(input1_data.shape[-2:]))</span><br><span class="line">    input2_data &#x3D; input2_data.reshape([3, -1]+list(input2_data.shape[-2:]))</span><br><span class="line"></span><br><span class="line">    input_data &#x3D; list()</span><br><span class="line">    input_data.append(np.transpose(input0_data, (2, 3, 0, 1)))</span><br><span class="line">    input_data.append(np.transpose(input1_data, (2, 3, 0, 1)))</span><br><span class="line">    input_data.append(np.transpose(input2_data, (2, 3, 0, 1)))</span><br><span class="line"></span><br><span class="line">    boxes, classes, scores &#x3D; yolov5_post_process(input_data)</span><br><span class="line"></span><br><span class="line">    img_1 &#x3D; cv2.cvtColor(img, cv2.COLOR_RGB2BGR)</span><br><span class="line">    if boxes is not None:</span><br><span class="line">        draw(img_1, boxes, scores, classes)</span><br><span class="line">    # show output</span><br><span class="line">    cv2.imshow(&quot;post process result&quot;, img_1)</span><br><span class="line">    cv2.waitKey(0)</span><br><span class="line">    cv2.destroyAllWindows()</span><br><span class="line"></span><br><span class="line">    rknn.release()</span><br></pre></td></tr></table></figure></li>
<li>运行程序 <figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">python deploy.py</span><br></pre></td></tr></table></figure></li>
<li>结果展示<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">--&gt; Load RKNN model</span><br><span class="line">--&gt; Init runtime environment</span><br><span class="line">I RKNN: [13:00:34.125] RKNN Runtime Information: librknnrt version: 1.4.0 (a10f100eb@2022-09-09T09:07:14)</span><br><span class="line">I RKNN: [13:00:34.125] RKNN Driver Information: version: 0.8.2</span><br><span class="line">I RKNN: [13:00:34.125] RKNN Model Information: version: 1, toolkit version: 1.4.0-22dcfef4(compiler version: 1.4.0 (3b4520e4f@2022-09-05T20:52:35)), target: RKNPU v2, target platform: rk3588, framework name: ONNX, framework layout: NCHW</span><br><span class="line">done</span><br><span class="line">class: person, score: 0.8928694725036621</span><br><span class="line">box coordinate left,top,right,down: [40.627504616975784, 235.50569766759872, 193.95716640353203, 534.8807769417763]</span><br><span class="line">class: person, score: 0.878767728805542</span><br><span class="line">box coordinate left,top,right,down: [531.5798395127058, 224.8939728140831, 639.2570745497942, 524.2690520882607]</span><br><span class="line">class: person, score: 0.8309085965156555</span><br><span class="line">box coordinate left,top,right,down: [174.62115895748138, 241.39454793930054, 273.0503498315811, 510.30296182632446]</span><br><span class="line">class: person, score: 0.4691559970378876</span><br><span class="line">box coordinate left,top,right,down: [0.81878662109375, 325.4185321331024, 54.147705078125, 517.9757549762726]</span><br><span class="line">class: bicycle, score: 0.24984873831272125</span><br><span class="line">box coordinate left,top,right,down: [530.9477665424347, 11.197928547859192, 597.0226924419403, 57.32749259471893]</span><br><span class="line">class: bus , score: 0.5245066285133362</span><br><span class="line">box coordinate left,top,right,down: [9.820066332817078, 131.40282291173935, 624.8392354249954, 430.7779021859169]</span><br></pre></td></tr></table></figure>
<img src="/images/d9be880033446e815ed371843246ae1.png" alt=""></li>
</ol>
<h2 id="帮助文档"><a href="#帮助文档" class="headerlink" title="帮助文档"></a>帮助文档</h2><ul>
<li><p>源码<br><a href="https://github.com/rockchip-linux/rknpu2" target="_blank" rel="noopener">https://github.com/rockchip-linux/rknpu2</a><br><a href="https://github.com/rockchip-linux/rknn-toolkit2" target="_blank" rel="noopener">https://github.com/rockchip-linux/rknn-toolkit2</a><br><a href="https://github.com/ultralytics/yolov5" target="_blank" rel="noopener">https://github.com/ultralytics/yolov5</a></p>
</li>
<li><p>ROC-RK3588-PC<br><a href="https://wiki.t-firefly.com/zh_CN/ROC-RK3588-PC/usage_npu.html" target="_blank" rel="noopener">https://wiki.t-firefly.com/zh_CN/ROC-RK3588-PC/usage_npu.html</a></p>
</li>
<li><p>【边缘设备】yolov5训练与rknn模型导出并在RK3588部署~1.环境准备（亲测有效）<br><a href="https://blog.csdn.net/zhoujinwang/article/details/132320665" target="_blank" rel="noopener">https://blog.csdn.net/zhoujinwang/article/details/132320665</a></p>
</li>
<li><p>香橙派5 RK3588 yolov5模型转换rknn及部署踩坑全记录 orangepi 5<br><a href="https://blog.csdn.net/m0_55217834/article/details/130583886" target="_blank" rel="noopener">https://blog.csdn.net/m0_55217834/article/details/130583886</a></p>
</li>
</ul>
<hr>
<center>
<table>
    <tr>
        <td >
            <center>
                <img src="https://i.loli.net/2020/01/08/CJz85Sbal6M7EOV.png" width="200"/>
            </center>
            <center style="font-weight:900">
                微信：宏沉一笑
            </center>
        </td>
        <td >
            <center>
                <img src="https://i.loli.net/2020/01/08/veq2DSphHME9KPV.jpg" width="200"/>
            </center>
            <center style="font-weight:900">
                公众号：登山客
            </center>
        </td>
    </tr>
</table>
</center>

<p><strong>签名：Smile every day</strong><br><strong>名字：宏沉一笑</strong><br><strong>邮箱：<a href="mailto:whghcyx@outlook.com">whghcyx@outlook.com</a></strong><br><strong>个人网站：<a href="https://whg555.github.io" target="_blank" rel="noopener">https://whg555.github.io</a></strong>  </p>
<hr>

      
       <hr><span style="font-style: italic;color: gray;"> 转载请注明来源，欢迎对文章中的引用来源进行考证，欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论，也可以邮件至 whghcyx@outlook.com </span>
    </div>
</article>


<p>
    <a  class="dashang" onclick="dashangToggle()">赏</a>
</p>


<div class="article_copyright">
    <p><span class="copy-title">文章标题:</span>香橙派-RKNN-Yolov5</p>
    <p><span class="copy-title">文章字数:</span><span class="post-count">3.3k</span></p>
    <p><span class="copy-title">本文作者:</span><a  title="宏沉一笑">宏沉一笑</a></p>
    <p><span class="copy-title">发布时间:</span>2024-03-30, 11:59:22</p>
    <p><span class="copy-title">最后更新:</span>2024-03-30, 16:52:57</p>
    <span class="copy-title">原始链接:</span><a class="post-url" href="/2024/03/30/AI-2024-03-30-%E9%A6%99%E6%A9%99%E6%B4%BE-RKNN-Yolov5-v2/" title="香橙派-RKNN-Yolov5">https://whghcyx.gitee.io/2024/03/30/AI-2024-03-30-%E9%A6%99%E6%A9%99%E6%B4%BE-RKNN-Yolov5-v2/</a>
    <p>
        <span class="copy-title">版权声明:</span><i class="fa fa-creative-commons"></i> <a rel="license noopener" href="http://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank" title="CC BY-NC-SA 4.0 International" target = "_blank">"署名-非商用-相同方式共享 4.0"</a> 转载请保留原文链接及作者。
    </p>
</div>





    




    </div>
    <div class="copyright">
        <p class="footer-entry">©2016-2019 Hcyx</p>
 <!--<p class="footer-entry">Built with <a href="https://hexo.io/" target="_blank">Hexo</a> and <a href="https://github.com/yelog/hexo-theme-3-hexo" target="_blank">3-hexo</a> theme</p>-->

    </div>
    <div class="full-toc">
        <button class="full"><span class="min "></span></button>
<button class="post-toc-menu"><span class="post-toc-menu-icons"></span></button>
<div class="post-toc"><span class="post-toc-title">目录</span>
    <div class="post-toc-content">

    </div>
</div>
<a class="" id="rocket" ></a>

    </div>
</div>
<div class="acParent"></div>

<div class="hide_box" onclick="dashangToggle()"></div>
<div class="shang_box">
    <a class="shang_close"  onclick="dashangToggle()">×</a>
    <div class="shang_tit">
        <p>喜欢就点赞,疼爱就打赏</p>
    </div>
    <div class="shang_payimg">
        <div class="pay_img">
            <img src="/img/alipay.jpg" class="alipay" title="扫码支持">
            <img src="/img/weixin.jpg" class="weixin" title="扫码支持">
        </div>
    </div>
    <div class="shang_payselect">
        <span><label><input type="radio" name="pay" checked value="alipay">支付宝</label></span><span><label><input type="radio" name="pay" value="weixin">微信</label></span>
    </div>
</div>


</body>
<script src="/js/jquery.pjax.js?v=1.0.1" ></script>

<script src="/js/script.js?v=1.0.1" ></script>
<script>
    var img_resize = 'default';
    /*作者、标签的自动补全*/
    $(function () {
        $('.search').AutoComplete({
            'data': ['#demo','#下载','#总览','#调试','#注释','#ubuntu','#ros','#obsidian','#软件','#安卓','#配置','#cmd','#Colab','#tensorboard','#conda','#Opencv 编译','#激活','#python','#QT','#问题','#Android','#安装','#AI','#框架','#模型','#本地','#编程语言','#C语言','#C加加','#Python','#ncnn','#OpenCV','#Linux','#编译','#部署','#代码','#日志','#界面',],
            'itemHeight': 20,
            'width': 418
        }).AutoComplete('show');
    })
    function initArticle() {
        /*渲染对应的表格样式*/
        
            $(".post .pjax table").addClass("green_title");
        

        /*渲染打赏样式*/
        
        $("input[name=pay]").on("click", function () {
            if($("input[name=pay]:checked").val()=="weixin"){
                $(".shang_box .shang_payimg .pay_img").addClass("weixin_img");
            } else {
                $(".shang_box .shang_payimg .pay_img").removeClass("weixin_img");
            }
        })
        

        /*高亮代码块行号*/
        
        $('pre code').each(function(){
            var lines = $(this).text().split('\n').length - 1, widther='';
            if (lines>99) {
                widther = 'widther'
            }
            var $numbering = $('<ul/>').addClass('pre-numbering ' + widther).attr("unselectable","on");
            $(this).addClass('has-numbering ' + widther)
                    .parent()
                    .append($numbering);
            for(var i=1;i<=lines;i++){
                $numbering.append($('<li/>').text(i));
            }
        });
        

        /*访问数量*/
        
        $.getScript("//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js");
        

        /*代码高亮，行号对齐*/
        $('.pre-numbering').css('line-height',$('.has-numbering').css('line-height'));

        
        
    }

    /*打赏页面隐藏与展示*/
    
    function dashangToggle() {
        $(".shang_box").fadeToggle();
        $(".hide_box").fadeToggle();
    }
    

</script>

<!--加入行号的高亮代码块样式-->

<style>
    pre{
        position: relative;
        margin-bottom: 24px;
        border-radius: 10px;
        border: 1px solid #e2dede;
        background: #FFF;
        overflow: hidden;
    }
    code.has-numbering{
        margin-left: 30px;
    }
    code.has-numbering.widther{
        margin-left: 35px;
    }
    .pre-numbering{
        margin: 0px;
        position: absolute;
        top: 0;
        left: 0;
        width: 20px;
        padding: 0.5em 3px 0.7em 5px;
        border-right: 1px solid #C3CCD0;
        text-align: right;
        color: #AAA;
        background-color: #fafafa;
    }
    .pre-numbering.widther {
        width: 35px;
    }
</style>

<!--自定义样式设置-->
<style>
    
    
    .nav {
        width: 542px;
    }
    .nav.fullscreen {
        margin-left: -542px;
    }
    .nav-left {
        width: 120px;
    }
    
    
    @media screen and (max-width: 1468px) {
        .nav {
            width: 492px;
        }
        .nav.fullscreen {
            margin-left: -492px;
        }
        .nav-left {
            width: 100px;
        }
    }
    
    
    @media screen and (max-width: 1024px) {
        .nav {
            width: 492px;
            margin-left: -492px
        }
        .nav.fullscreen {
            margin-left: 0;
        }
        .nav .hide-list.fullscreen {
            left: 492px
        }
    }
    
    @media screen and (max-width: 426px) {
        .nav {
            width: 100%;
        }
        .nav-left {
            width: 100%;
        }
    }
    
    
    .nav-right .title-list nav a .post-title, .nav-right .title-list #local-search-result a .post-title {
        color: #383636;
    }
    
    
    .nav-right .title-list nav a .post-date, .nav-right .title-list #local-search-result a .post-date {
        color: #5e5e5f;
    }
    
    
    .nav-right nav a.hover, #local-search-result a.hover{
        background-color: #e2e0e0;
    }
    
    

    /*列表样式*/
    
    .post .pjax article .article-entry>ol, .post .pjax article .article-entry>ul, .post .pjax article>ol, .post .pjax article>ul{
        border: #e2dede solid 1px;
        border-radius: 10px;
        padding: 10px 32px 10px 56px;
    }
    .post .pjax article .article-entry li>ol, .post .pjax article .article-entry li>ul,.post .pjax article li>ol, .post .pjax article li>ul{
        padding-top: 5px;
        padding-bottom: 5px;
    }
    .post .pjax article .article-entry>ol>li, .post .pjax article .article-entry>ul>li,.post .pjax article>ol>li, .post .pjax article>ul>li{
        margin-bottom: auto;
        margin-left: auto;
    }
    .post .pjax article .article-entry li>ol>li, .post .pjax article .article-entry li>ul>li,.post .pjax article li>ol>li, .post .pjax article li>ul>li{
        margin-bottom: auto;
        margin-left: auto;
    }
    

    /* 背景图样式 */
    
    


    /*引用块样式*/
    

    /*文章列表背景图*/
    
    .nav-right:before {
        content: ' ';
        display: block;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        opacity: 0.3;
        background: url("https://i.loli.net/2019/07/22/5d3521411f3f169375.png");
        background-repeat: no-repeat;
        background-position: 50% 0;
        -ms-background-size: cover;
        -o-background-size: cover;
        -moz-background-size: cover;
        -webkit-background-size: cover;
        background-size: cover;
    }
    

    
</style>







</html>
